require("sqliteConfig")
local json =require("cjson")

local conn=getConnect()

--查询
local rs,d=conn:execute("select * from short_url order by id desc limit 5")
local row = rs:fetch({},"a")
function copyBean(row) 
    local item={}
    for k,v in pairs(row) do
        item[k]=v
    end
    return item 
end

local list={}
local i=1
while row do
    list[i]=row
    row = rs:fetch({},"a")
    i=i+1
end
rs:close()
-- conn:close()
result={
    code=0,
    msg="OK",
    list=list
}
js=json.encode(result)
response={
    body=js,
    header={}
}
response.header["Content-Type"]="application-json;charset=utf-8"




